import request from './request'
import type { LoginForm, LoginResponse, ApiResponse } from '@/types'

// 登录
export const login = (data: LoginForm): Promise<LoginResponse> => {
  return request.post('/auth/login', data)
}

// 获取用户信息
export const getUserInfo = (): Promise<LoginResponse> => {
  return request.get('/auth/userinfo')
}

// 登出
export const logout = (): Promise<ApiResponse> => {
  return request.post('/auth/logout')
}

// 刷新token
export const refreshToken = (): Promise<{ token: string }> => {
  return request.post('/auth/refresh')
}

